package com.luhuiguo.cms.client.ui;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.luhuiguo.cms.client.presenter.HeaderPresenter;

/**
 * 页首视图。
 * 
 * @author LuHuiguo
 * @version $Id: HeaderView.java 96 2010-03-21 07:28:41Z luhuiguo@gmail.com $
 */
@Singleton
public class HeaderView extends Composite implements HeaderPresenter.Display {

    private static HeaderViewUiBinder uiBinder = GWT.create(HeaderViewUiBinder.class);

    interface HeaderViewUiBinder extends UiBinder<Widget, HeaderView> {
    }

    @UiField
    Label userLabel;

    @UiField
    Anchor logoutLink;

    @UiField
    Anchor aboutLink;

    @Inject
    public HeaderView() {
        initWidget(uiBinder.createAndBindUi(this));
        GWT.log("HeaderView created");
    }

    @Override
    public Widget asWidget() {
        return this;
    }

    @Override
    public HasClickHandlers getAboutClick() {
        return aboutLink;
    }

    @Override
    public HasClickHandlers getLogoutClick() {
        return logoutLink;
    }

    @Override
    public HasText getUserText() {
        return userLabel;
    }

}
